home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 824 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.9 KB

  1. Path: newsserver.rrzn.uni-hannover.de!tubsibr!duening
  2. From: duening@ibr.cs.tu-bs.de (Lars Duening)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: PPC compilers
  5. Date: 11 Jan 1996 22:36:09 GMT
  6. Organization: TU Braunschweig, Informatik (Bueltenweg), Germany
  7. Distribution: world
  8. Message-ID: <4d43cq$ifg@ra.ibr.cs.tu-bs.de>
  9. References: <john.hendrikx.40ka@grafix.xs4all.nl> <4b77tq$htp@serpens.rhein.de> <MQAQx*XOe@yaps.rhein.de> <4bqhnf$6g5@sunsystem5.informatik.tu-muenchen.de> <jasonb.820051107@cs.uwa.edu.au> <4c9i2l$h3i@sunsystem5.informatik.tu-muenchen.de> <4cf0ep$233@ra.i <4ck37m$g07@maureen.teleport.com> <4cs8ce$ljg@ra.ibr.cs.tu-bs.de> <4cujve$dmn@maureen.teleport.com>
  10. Reply-To: duening@ibr.cs.tu-bs.de (Lars Duening)
  11. NNTP-Posting-Host: kastor.ibr.cs.tu-bs.de
  12.  
  13. In article <4cujve$dmn@maureen.teleport.com> sschaem@teleport.com (Stephan Schaem) writes:
  14. >Lars Duening (duening@ibr.cs.tu-bs.de) wrote:
  15. >: I need to know if it's a scalar type (further subdivided into integer
  16. >: and floating types), an array, a structure, a pointer or else, but I
  17. >: do not need to know it's exakt size in byte when using it.
  18. >
  19. > You need to know the type range... if you choose to ignore this, you
  20. > will have to select the largest type avail for real/interger.
  21.  
  22. I still don't need to know or care about the _implementation_ and the
  23. _size_ - and that's what this discussion was about.
  24. Nobody denies that knowing the other type properties is still
  25. necessary (more or less).
  26.  
  27. > But the point really is you need to know and keep track what your 
  28. > variable are. basicly in asm you write what you are thinking,
  29. > but with a limited range of type and no typedef offered.
  30. >
  31. >: Sometimes I don't even need to know the exact type 'cause the compiler
  32. >: will create conversion code plus overflow checking (I'm not talking
  33. >: just C here).
  34. >
  35. > I think thats a bad practice... just for the fact that you let the
  36. > compiler tell you what you assumed wrong.
  37.  
  38. I usually try to outsmart the compiler, but should I fail it's nice
  39. to know that the program won't go gaga.
  40. And look at this:
  41.  
  42.   a := SHORT(b);
  43.  
  44. The compiler is instructed here to create conversion code to assign b
  45. to a. I still don't need to know if it's a longword->word, word->byte or
  46. even quadword->longword conversion. I _do_ know that I convert a
  47. scalar type to a smaller value range.
  48.  
  49. >: > Otherwise you need to know that color0 is a word holding 12bit
  50. >: > of valid data grouped in 4bit nibles, 
  51. >
  52. >: typedef struct {
  53. >:   int r : 4;
  54. >:   int g : 4;
  55. >:   int b : 4;
  56. >: } color0_t;
  57. >
  58. >: color0_t color0;
  59. >
  60. > Now somewhere one should read the range of r,g,b... or you must
  61. > also provide a set of routine that will work on this structure/type
  62. > (Example: only value from 0 to 12 are valid. But you will make your 
  63. > user function prototype use float and define the valid range)
  64.  
  65. This is a completely different problem, and even that could be solved:
  66.  
  67. TYPE COLOR0 = PACKED RECORD
  68.   r, g, b : INTEGER [0..12];
  69. END;
  70.  
  71. VAR color0 : COLOR0;
  72. -- 
  73. Lars Duening; duening@ibr.cs.tu-bs.de
  74.